package com.tod.spark.springbootspark.sql;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SQLContext;

public class SpecifyFormatLoadSave {
    public static void main(String[] args) {
        SparkConf conf = new SparkConf().setAppName("dataframe").setMaster("local");
        JavaSparkContext jsc = new JavaSparkContext(conf);
        SQLContext sqlContext = new SQLContext(jsc);
        Dataset<Row> peopleDS = sqlContext.read().format("json").load("src/main/resources/static/people.json");
        peopleDS.select("name").write().format("parquet").save("peopleName.parquet");
        jsc.stop();
    }
}
